//三相电流
//三项电流数据
date1=(function() {
	// 生成随机值
	var data = [], 
	time = (new Date()).getTime(), 
	i;
	for (i = -100; i <= 0; i += 1) {
		data.push({
			x : time + i * 1000*2400,
			y : 8 +Math.round(Math.random()*10)
		});
	}
	return data;
}());
date2=(function() {
	// 生成随机值
	var data = [], 
	time = (new Date()).getTime(), 
	i;
	for (i = -100; i <= 0; i += 1) {
		data.push({
			x : time + i * 1000*2400,
			y : 8.4 +Math.round(Math.random()*10)
		});
	}
	return data;
}());
date3=(function() {
	// 生成随机值
	var data = [], 
	time = (new Date()).getTime(), 
	i;
	for (i = -100; i <= 0; i += 1) {
		data.push({
			x : time + i * 1000*2400,
			y : 8.5 +Math.round(Math.random()*10)
		});
	}
	return data;
	}()); 
	/* var datetype=$('#Tphase option:selected').val();
	console.info("datetype"+datetype); */
	//功率曲线图
	Highcharts.setOptions({
		colors : [ 'yellow','#02DB72','red' ]
	});


var chart = Highcharts.chart('phase', {
	chart : {
		type : 'line',
		marginRight : 30,
		backgroundColor : '#3b5261',
		plotBorderWidth : 0,
		ignoreHiddenSeries : true,
		reflow : true,
		spacingTop : 50, //图表上方的空白
		spacingRight : 40,
		spacingLeft : 0,
		spacingBottom: 30,
		borderRadius : 1,
		zoomType: 'x',
		panning: true,
		panKey: 'shift'
		
		/* events : {
			load : function() {
				var series = this.series[0]; 
				var series1 = this.series[1];
				var series2 = this.series[2]; 
				setInterval(function () { 
				var x = (new Date()).getTime(), // current time 
				y = Math.random()*1000; 
				y2 = Math.random()*1000; 
				y3= Math.random()*1000;
				series.addPoint([x, y], true, true); 
				series1.addPoint([x, y2], true, true); 
				series2.addPoint([x, y3], true, true);
				}, 3000);
			}
		} */
	},
	credits:{
			enabled:false
	},//去掉水印
	title: {
		text: '三相电流',
		floating: true,
	    align: 'left',
	    x: 0,
	    y: -20,
		style:{
			color:'#fff'
		}
	},
	xAxis: {
		type : 'datetime',
		tickmarkPlacement:'on',//x轴底部显示对齐方式
		tickwidth:0,
		labels : {//设置横轴坐标的显示样式
			align : 'center',
			style : {
				color : '#fff'
			}
		},
		dateTimeLabelFormats: { 
            hour:"%m-%e %H:%M",
        	day:"%m-%e",
        	month:"%Y-%m",
         },
		},
		tooltip: {
			shared: true,
			crosshairs: true,
			formatter : function (){ // 提示框格式化字符串
			 	 var d = new Date(this.x);
                 var s = '<b>' + d.getFullYear() + '/' + (d.getMonth() + 1) + '/' + d.getDate() + ' '  + d.getHours() + ':'+ d.getMinutes() + ':' + d.getSeconds()+ '</b>';
                 $.each(this.points ,function(){
                     s += '<br />' + this.series.name + ':' + this.y;
                 });
                 return s;
             },
            valueDecimals : 3,
            xDateFormat : '%Y-%m-%d', //  如果 X轴是时间轴，格式化提示框标题中的日期
		},
	yAxis: {
		title: {
			text: '单位(A)',
			style:{
				color:'#fff',
			}
		},
		minPadding:0,
		gridLineWidth:0,
		lineColor: '#FFF',
		lineWidth: 1,
		labels : {//设置横轴坐标的显示样式
				align : 'center',
				style : {
					color : '#fff'
				}
			}
	},
	legend: {
		layout: 'horizontal',
		align: 'right',
		verticalAlign: 'top',
		x: -50,
	    y: -50,
		itemStyle:{
			color:'#FFF'
		}
	},
	
	series : [ {
		marker:{//线上数据点
		   	radius:0,
		   	lineWidth:0,
		   	lineColor:'#fba845',
		   	fillColor:'#fba845',
		   	states:{
		   		hover:{
		   			enabled:false
		   		}
		   	}
		},
		name : 'A相电流',
		data : date1
		},{
			marker:{//线上数据点
		   	radius:0,
		   	lineWidth:0,
		   	lineColor:'#fba845',
		   	fillColor:'#fba845',
		   	states:{
		   		hover:{
		   			enabled:false
		   		}
		   	}
		},
		name : 'B相电流',
		data : date2
		},{
		marker:{//线上数据点
		   	radius:0,
		   	lineWidth:0,
		   	lineColor:'#fba845',
		   	fillColor:'#fba845',
		   	states:{
		   		hover:{
		   			enabled:false
		   		}
		   	}
		},
		name : 'C相电流',
		data : date3
		} ],
	responsive: {
		rules: [{
			condition: {
				maxWidth: 500
			},
			chartOptions: {
				legend: {
					layout: 'horizontal',
					align: 'center',
					verticalAlign: 'bottom'
				}
			}
		}]
	},
});



